--[[ 编码: WMS-54-01 名称: 供应商-创建前 作者:HAN 日期:2025-1-29 级别:固定 (说明本段代码在项目中不太会变化) 函数: BeforeDataObjCreate 功能: 1)生成供应商编码 S_NO 格式:SP-0001 变更记录: V6.0 HAN 2023/9/6 -- lua.Error/lua.Debug 函数变化 --]] json = require ("json") mobox = require ("OILua_JavelinExt") m3 = require("oi_base_mobox") function BeforeDataObjCreate ( strLuaDEID ) local nRet, strRetInfo -- 生成供应商编码 local strCode = '' nRet,strCode = mobox.getSerialNumber( "供应商", "SP-", 4 ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), '申请【供应商】编码失败!'..strCode ) end -- 设置信息 local attr_value = {} attr_value[1] = lua.KeyValueObj( "S_NO", strCode ) nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "设置【供应商】信息失败! "..strRetInfo ) end end